#coding=utf-8

class Price(object):

    def get_interval(self):
        return '%0.2f--%0.2f'%(self.lowest, self.highest)
    interval = property(fget=get_interval)

    def get_fqr(self):
        s = self.td.fins
        
        if s.type != 'stock':return None
        
        dt = self.td.date.isoformat()
        
        for fqr in s.fqrs:
            if dt >= fqr.date.isoformat():
                return fqr.ratio
        return None                
    fqr = property(fget=get_fqr)
    
    def fq(self, item):
        return getattr(self, item)*self.fqr
                
class RTPrice(object):
    pass

class Deal2(object):
    pass
    
class DealStats(object):
    
    def todict(self):
        r = {}
        
        r['b'] = [self.buy_num, self.buy_money]
        r['s'] = [self.sell_num, self.sell_money]
        r['n'] = [self.neutral_num, self.neutral_money]
        r['b-s'] = [self.bs_num, self.bs_money]

        return r        
        

class FuQuanRatio(object):
    pass
